﻿package fui.FUIControllers{
	
	public class UISession{
		private var _uid:int = 0;
		private var _user_name:String = '';
		private var _login_time:Date;
		private var _profile:Object;
		private var _logged:Boolean = false;
		public function UISession(){
			trace("User session inited");
			
		}
		public function dropSession():void{
			this._uid = 0;
			this._user_name = '';
			this._login_time = null;
			this._logged = false;
			trace("Session dropped");
		}
		public function startNewSession(uid:int, uname:String):void{
			this._uid = uid;
			this._user_name = uname;
			this._login_time = new Date();
			this._logged =true;
			trace("Session started on "+ _login_time);
		}
		public function set profile(profile:Object):void{
			this._profile = profile;
		}
		public function get profile():Object
		{
			if( isLoggedIn())
			{
				return this._profile;
			}
			return null;
		}
		public function get uid():int{
			return _uid;
		}
		public function get name():String{
			return _user_name;
		}
		public function loginres(iflog:Boolean):void
		{
			this._logged = iflog;
		}
		public function isLoggedIn():Boolean{
			return this._logged;
		}
	}
	
}